﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using ExpertSystem.Exeptions;

namespace ExpertSystem.Domains
{
    public class InAreaFunction :Function
    {
        #region Overrides of Function

       
       
        #endregion

        public override bool Calculate()
        {
            int leftvalue = 0;
            int middlevalue = 0;
            int rightvalue = 0;
            
            if (this.Variables.Count == 3)
            {
                int.TryParse(Variables[0].Value.ToString(), out middlevalue);
                int.TryParse(Variables[1].Value.ToString(), out leftvalue);
                int.TryParse(Variables[2].Value.ToString(), out rightvalue);
                return (leftvalue < middlevalue) && (rightvalue > middlevalue);
            }
            else
            {
                throw new WrongNumberOfArguments();
            }
        }
    }
}
